package com.duobaoyu.dby.supply.admin.converter;

import com.duobaoyu.dby.common.core.constant.CommonConstants;
import com.duobaoyu.dby.common.core.convert.bean.ReferenceMapper;
import com.duobaoyu.dby.supply.common.biz.bo.refund.*;
import com.duobaoyu.dby.supply.common.biz.dto.refund.AfterSaleContactDTO;
import com.duobaoyu.dby.supply.common.biz.dto.refund.AfterSaleFixDTO;
import com.duobaoyu.dby.supply.common.biz.dto.refund.AfterSaleReturnAddressDTO;
import org.mapstruct.*;

import java.util.List;

/**
 * Created by shuming on 2023/11/23 14:54
 */
@Mapper(uses = ReferenceMapper.class,
        nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS,
        builder = @Builder(disableBuilder = true), componentModel = CommonConstants.COMPONENT_MODEL)
public interface AdminAfterSaleBizServiceConverter {

    @Mapping(target = "customerReturnAddress", expression = "java(convertCustomerReturnAddress(content.getAfterSaleReturnAddress()))")
    @Mapping(target = "contactInfo", expression = "java(convertAfterSaleContactInfo(content.getAfterSaleContact()))")
    @Mapping(target = "afterSaleItems", ignore = true)
    AfterSaleModifyInBO convertAfterSaleModifyIn(AfterSaleFixDTO.Content content);

    AfterSaleContactInfoBO convertAfterSaleContactInfo(AfterSaleContactDTO afterSaleContact);

    CustomerReturnAddressBO convertCustomerReturnAddress(AfterSaleReturnAddressDTO afterSaleReturnAddress);

    void copyAfterSaleItem(@MappingTarget List<AfterSaleItemInBO> existItems,
                           List<AfterSaleFixDTO.Item> items);

    List<AfterSaleItemInBO> convertAfterSaleItemIn(List<AfterSaleItemOutBO> afterSaleItemOutList);
}
